package impl

import (
	"mvip-route/config"
	"mvip-route/service/model"
)

type LogService struct {
}

func (log *LogService) SaveLog(save *model.Log) {
	tx := config.DB.Table("dam_red_log").Save(&save)
	if tx.Error == nil {
		println("保存日志成功")
		return
	}
	println("保存日志失败")
	println(tx.Error)
}

func (log *LogService) GetLogs() ([]model.Log, error) {
	var logs []model.Log
	err := config.DB.Model(&model.Log{}).Order("id desc").Limit(12).Find(&logs).Error
	return logs, err
}
